package cn.lzd.mr.case10;


import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

/**
 * Created by lzd on 2018/6/5.
 */
public class GroupComparator10 extends WritableComparator {

    public GroupComparator10() {
        super(Text.class,true);
    }

    @Override
    public int compare(WritableComparable a, WritableComparable b) {
        System.out.println("====================================reduce分组开始-结束====================================");
        Text bean1 = (Text) a;
        Text bean2 = (Text) b;

        String[] split1 = bean1.toString().split(",");
        String[] split2 = bean2.toString().split(",");

        return split1[0].compareTo(split2[0]);

    }
}
